<?php
/**
 * Created by PhpStorm.
 * User: EDZ
 * Date: 2020/6/22
 * Time: 11:10
 */

namespace DesignPatterns\Structural\Adaptor;


class EBookAdaptor implements BookInterface
{
    /** @var EBookInterface */
    protected $eBook;

    /**
     * @param EBookInterface $eBook
     */
    public function __construct(EBookInterface $eBook)
    {
        $this->eBook = $eBook;
    }

    public function turnPage() {
        $this->eBook->pressNext();
    }

    public function open() {
        $this->eBook->unlock();
    }

    public function getPage(): int {
        return $this->eBook->getPage()[0];
    }
}